﻿using System;
using System.Collections;
using System.Collections.Generic;
namespace WPFExcelReport
{
        public class AB50AV95Report : BaseReport
    {
            string strCompany = "", strExcelFile = "";
            public string StandardType = "";
        public AB50AV95Report()
            : base()
        {
        }
        public AB50AV95Report(Dictionary<string, object> dicParamater)
            : base(dicParamater)
        {
            columns.Add("VKPAUFKRS"); 
            columns.Add("VKPAUFLFD"); 
            columns.Add("VKPAUFPOS"); 
            columns.Add("KDKUNDNA"); 
            columns.Add("VKPMENGE1"); 
            columns.Add("VKPWUTERM"); 
            columns.Add("ABPAUFKRS"); 
            columns.Add("ABPAUFLFD"); 
            columns.Add("ABPAUFPOS"); 
            columns.Add("ABPSOLLMENGE5"); 
            columns.Add("YARNUSAGE"); 
            columns.Add("HLTNUM"); 
            columns.Add("YPRODUCER"); 
            columns.Add("ABPSTARTDAT"); 
            columns.Add("ABPLIEFDAT"); 
            columns.Add("ABPART"); 
            columns.Add("ABPVAR"); 
            columns.Add("ABPFARBE");
            columns.Add("GWARPYARNINFO");
            columns.Add("REMARK");
            strCompany = dicParamater["Company"].ToString().Trim();
            strExcelFile = dicParamater["ExcelFile"].ToString().Trim();
        }
        public void WriteExcelReport(string fileType)
        {
            Queue CellQueue = new Queue();

            string filename = "";
            string sheetName = "";
            string Standard =StandardType;
            strExcelFile = @"HLT\HLTPlanningReport.xls";
            string filePath = @"C:\intex.w\Report\" + strExcelFile;
            exAgent.Open(filePath);
            exAgent.Company = strCompany;
            exAgent.strExcelFile = strExcelFile;
            string filedate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
            filename = @"Planning\染色\CB" + filedate + ".xls";
            sheetName = DateTime.Now.ToShortTimeString().Replace(@":", "");
            exAgent.CreateNewSheet(filename, Standard, sheetName);
            FillInData(columns, dsSource.Tables["ABPOS"]);
            if (exAgent != null)
            {
                exAgent.Save();
                exAgent.Close();
            }
        }
    }

}
